package com.itheima.controller;

import com.itheima.vo.App;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * @Author itheima
 * @Date 2022/5/2 9:47
 * 需求：写一个url能够供浏览器访问(http://localhost:8080/hello/robin)，返回数据：hello,robin
 */
@RestController
@Slf4j
public class HelloController {
    @Value("${uploadFile}")
    String uploadFile;
    @Value("${ips}")
    String[] ips;

    @Autowired
    App app;

    //http://localhost:8080/hello/robin,返回数据："hello,robin"
    @GetMapping("/hello/{name}")
    public String sayHello(@PathVariable String name) {
        log.info("uploadFile = {}", uploadFile);
        log.info("ips = {}", Arrays.asList(ips));
        log.info("app={}", app);
        return "hello," + name;
    }
}
